﻿/** \file
* \$Rev$
* 
* \$Date$
*
* \$URL$
*/

/// <summary>
/// The namespace containing all AI-related interfaces and classes.
/// </summary>
namespace BT211.AI
{
	/// <summary>
	/// This class represents a single action taken by a tank when Tick() is
	/// called.
	/// </summary>
	public class Action
	{
		/// <summary>Amount of energy to use for a shot. 0 for no shot.</summary>
		public double fire;
		/// <summary>Change in the angle of the tank base (radians).</summary>
		public double base_angle;
		/// <summary>Velocity of the tank base (cells per tick).</summary>
		public double base_vel;
		/// <summary>Change in the angle of the turret (radians).</summary>
		public double turret_angle;

		/// <summary>The constructor. Reset the action parameters.</summary>
		public Action() { Reset(); }

		/// <summary>Reset the action parameters to their default values.</summary>
		public void Reset()
		{
			fire = 0;
			base_angle = 0;
			base_vel = 0;
			turret_angle = 0;
		}
	}

	/// <summary>
	/// The base class for all artificial intelligence systems that control the
	/// behaviour of tanks.
	/// </summary>
	public abstract class AI
	{
		/// <summary>The tank that this AI controls.</summary>
		public IMyTankView me;

		/// <summary>The constructor.</summary>
		public AI()
		{
		}

		/// <summary>The tick function. Called on a regular basis to update the state of the tank.</summary>
		/// <returns>The new action to take on this tick.</returns>
		public virtual Action Tick()
		{
			return new Action();
		}
	}
}
